#!/bin/bash

function kvercmp()
{
	ver1=`echo $1 | sed 's/-/./'`
	ver2=`echo $2 | sed 's/-/./'`

	ret=0
	i=1
	while [ 1 ]; do
		digit1=`echo $ver1 | cut -d . -f $i`
		digit2=`echo $ver2 | cut -d . -f $i`

		if [ -z "$digit1" ]; then
			if [ -z "$digit2" ]; then
				ret=0
				break
			else
				ret=-1
				break
			fi
		fi

		if [ -z "$digit2" ]; then
			ret=1
			break
		fi

		if [ "$digit1" != "$digit2" ]; then
			if [ "$digit1" -lt "$digit2" ]; then
				ret=-1
				break
			fi
			ret=1
			break
		fi

		i=$((i+1))
	done
	echo $ret
}

kvercmp "$1" "$2"
